package com.hup.minicontroller.client.model;

import lombok.EqualsAndHashCode;
import lombok.Getter;

/**
 * 广播收到/搜到的服务端;
 * 注意:本类重写了equal方法
 *
 * @author hugan
 * @date 2021/5/11
 */
@Getter
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
public class LanBroadcastServer implements Comparable<LanBroadcastServer> {

    private String serverName;
    @EqualsAndHashCode.Include
    private String address;
    /**
     * 发现的时间
     */
    private long receiveTime;

    public LanBroadcastServer(String serverName, String address, long receiveTime) {
        this.serverName = serverName;
        this.address = address;
        this.receiveTime = receiveTime;
    }

    @Override
    public int compareTo(LanBroadcastServer o) {
        return address.compareTo(o.address);
    }

    @Override
    public String toString() {
        return "LanBroadcastServer{" +
                "serverName='" + serverName + '\'' +
                '}';
    }
}
